package cn.wolfcode.domain;

import com.alibaba.fastjson.JSON;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.HashMap;

@Data
public class Notice {
    private Long id;//id
    /**
     * 发布人id
     */
    private Employee issuer;//发布人
    //设置时间显示格式
    @DateTimeFormat(pattern = "yyyy-MM-dd HH-mm-ss")
    private Date pubdate;//发布时间
    private String title;//标题
    private String content;//内容
    private boolean read = false;//是否已读,默认否

    public String getJson(){
        HashMap<String, Object> map = new HashMap<>();
        map.put("pubdate",pubdate);
        map.put("title",title);
        map.put("content",content);
        map.put("id",id);
        map.put("read",read);
        /*if(issuer != null){
            map.put("sellerId",issuer.getId());
            map.put("sellerName",issuer.getName());
        }*/
        return JSON.toJSONString(map);
    }
}